package org.ybxb.report;

import java.util.HashMap;
import java.util.Map;

import org.ybxb.okhttp.utils.OkHttpClientUtils;
import org.ybxb.report.vo.Result;
import org.ybxb.report.vo.SolutionDetailVo;

import com.fasterxml.jackson.core.type.TypeReference;

import cn.hutool.core.map.MapUtil;

/**
 * @ProjectName: generator-report
 * @PackageName: org.ybxb.report
 * @Description:
 * @Author: hy.bai
 * @Date: 2025-07-09 14:20
 */
public class GeneratorReport {


  String projectId = "https://apmaw.ctapaas.cn/manage-app/solution/forAudit/1935982861982826498";
  String token =
      "Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyNDUsInRlbmFudElkIjozMCwidXNlcl9rZXkiOiIxNjQ4NWZlOS00NWMwLTQyMTMtYWY2NC00MTE2MzAwNmU1NGMiLCJ0ZW5hbnRBbGlhcyI6InN6emIiLCJleHAiOjE3NTIwODUzNDAsImlhdCI6MTc1MjA0MjE0MCwidXNlcm5hbWUiOiJiaHkxOTMzNzEwNTUzNSJ9.XD7WYhHkfPBjxEAjzSfMe2JorqFZETCNXkHREgA_lC0";

  public void generatorReport() {
    Map<String, String> headers = MapUtil.createMap(HashMap.class);
    headers.put("Authorization", token);
    TypeReference<Result<SolutionDetailVo>> typeReference = new TypeReference<>() {};
    Result<SolutionDetailVo> detailVoResult = OkHttpClientUtils.get(projectId, headers, typeReference);
    SolutionDetailVo solutionDetailVo = detailVoResult.getData();
    String projectName = solutionDetailVo.getName();
    String belongCompany = solutionDetailVo.getBelongCompany();
    System.out.println("解决方案名称：" + projectName);
    System.out.println("公司名称：" + belongCompany);
  }

}
